<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let arr = [
    {id: 1,name:'张二',age:18},
    {id: 2,name:'李四',age:20},
    {id: 3,name:'王五',age:15},
    {id: 1,name:'张三',age:18},
    {id: 4,name:'王六',age:19},
]

    for(let i = 0;i<= arr.length-1;i++){
      
      for(let j = i+1;j<=arr.length-1;j++){
        // console.log(arr[i].id,arr[j].id);
        if(arr[i].id === arr[j].id){
          arr.splice(i,1)
        }
      }
    }
    console.log(arr);
  </script>
</body>
</html>